package com.tz.fruit.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 商品简介实体类
 */
/*
private String origin;//产地 新西兰
private String storage;//储藏方法-0°及以上冷藏
private String nutrients;//营养元素-蛋白质，果胶，维生素C

private String sweetness;//水果甜度-3星
private String ShelfLife;//保质期-12个月

private String origin;//产地 新西兰
private String storage;//存储方法  -18°~0°冷冻  
private String remarks;//备注 单个重130-160g
private String info;//说明 商品实际重量存在误差(±5%)
private String pno;//产品编号 2150414102
*/
@Entity
@Table(name="FRUIT_INTRO")
public class Intro implements Serializable{
	private Long introId;//简介ID

	private String key;//简介名称
	private String value;//简介内容

	
	private Product product;//所属商品
	
	public Intro() {
	}

	public Intro(String key, String value, Product product) {
		super();
		this.key = key;
		this.value = value;
		this.product = product;
	}
	@Id
	@GeneratedValue
	public Long getIntroId() {
		return introId;
	}

	public void setIntroId(Long introId) {
		this.introId = introId;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	@ManyToOne
	@JoinColumn(name="pid")
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((introId == null) ? 0 : introId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Intro other = (Intro) obj;
		if (introId == null) {
			if (other.introId != null)
				return false;
		} else if (!introId.equals(other.introId))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Intro [introId=" + introId + ", key=" + key + ", value=" + value + "]";
	}
	
}
